import { Company } from "src/modules/company/company.entity";
import { Order } from "src/modules/order/order.entity";
import {
  Column,
  CreateDateColumn,
  Entity,
  ManyToOne,
  OneToMany,
  PrimaryGeneratedColumn,
} from "typeorm";

@Entity()
export class Quality {
  @PrimaryGeneratedColumn("uuid")
  id: string;

  @ManyToOne(() => Company, (company) => company.qualities, { nullable: false })
  company: Company;

  @CreateDateColumn()
  date: Date;

  @Column()
  value: string;

  @OneToMany(() => Order, (order) => order.quality)
  orders: Order[];
}
